package com.aiyun.rabbit.rabbitdemo.config;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class StockQueueConfiguration {

	@Bean
	public DirectExchange stockExchange(){
		return new DirectExchange("exchange.stock");
	}

	@Bean
	public Queue stockReceiveQueue(){
		return new Queue("queue.stock.receive");
	}

	@Bean
	public Binding bindingStockReceiveToExchange(){
		return BindingBuilder.bind(stockReceiveQueue()).to(stockExchange()).with("confirm");
	}
}
